<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <title>Performance Test of NumberTextBox</title>

    <style type="text/css">
      @import "../../../dojo/resources/dojo.css";
      @import "../css/dijitTests.css";
    </style>

    <!-- required: the default dijit theme: -->
    <link id="themeStyles" rel="stylesheet" href="../../../dijit/themes/tundra/tundra.css">

    <!-- required: dojo.js -->
    <script type="text/javascript" src="../../../dojo/dojo.js"
      djConfig="isDebug: true, parseOnLoad: true"></script>

    <!-- only needed for alternate theme testing: -->
    <script type="text/javascript" src="../_testCommon.js"></script>

    <script type="text/javascript">
      dojo.require("dijit.dijit"); // optimize: load dijit layer
      dojo.require("dijit.form.TextBox");
      dojo.require("dijit.form.ValidationTextBox");
      dojo.require("dijit.form.NumberTextBox");
      dojo.require("dijit.form.Form");
      dojo.require("dojo.parser");  // scan page for widgets and instantiate them
    </script>

  </head>

  <body class="tundra">
    <script>
      function performancetest() {
        console.log("Dojo version " + dojo.version);
        var startTime1 = (new Date()).getTime();
        dijit.byId("form1").reset();
        console.log("Time 1: Reset form with NumberTextBox-fields: " + ((new Date()).getTime() - startTime1) + " millis");

        var startTime2 = (new Date()).getTime();
        dijit.byId("form2").reset();
        console.log("Time 2: Reset form with ValidationTextBox-fields: " + ((new Date()).getTime() - startTime2) + " millis");

        var startTime3 = (new Date()).getTime();
        for (var i = 1; i <= 20; i++) {
			    var w = dijit.byId("input1_" + i);
			    if(dojo.version.major == 1 && dojo.version.minor == 2) {
			      w.attr("value", i);
			    } else {
			      w.attr("value", i);
			    }
			  }
        console.log("Time 3: Inserting value into NumberTextBox-fields: " + ((new Date()).getTime() - startTime3) + " millis");

        var startTime4 = (new Date()).getTime();
        for (var i = 1; i <= 20; i++) {
			    var w = dijit.byId("input2_" + i);
			    if(dojo.version.major == 1 && dojo.version.minor == 2) {
			      w.attr("value", i);
			    } else {
			      w.attr("value", i);
			    }
			  }
        console.log("Time 4: Inserting value into ValidationTextBox-fields: " + ((new Date()).getTime() - startTime4) + " millis");
      }
    </script>
      <form id="form1" dojoType="dijit.form.Form" action="" method="">
      <input id="input1_1" name="input1" maxLength="6" type="text" dojoType="dijit.form.NumberTextBox"/>
      <input id="input1_2" name="input1" maxLength="6" type="text" dojoType="dijit.form.NumberTextBox"/>
      <input id="input1_3" name="input1" maxLength="6" type="text" dojoType="dijit.form.NumberTextBox"/>
      <input id="input1_4" name="input1" maxLength="6" type="text" dojoType="dijit.form.NumberTextBox"/>
      <input id="input1_5" name="input1" maxLength="6" type="text" dojoType="dijit.form.NumberTextBox"/>
      <input id="input1_6" name="input1" maxLength="6" type="text" dojoType="dijit.form.NumberTextBox"/>
      <input id="input1_7" name="input1" maxLength="6" type="text" dojoType="dijit.form.NumberTextBox"/>
      <input id="input1_8" name="input1" maxLength="6" type="text" dojoType="dijit.form.NumberTextBox"/>
      <input id="input1_9" name="input1" maxLength="6" type="text" dojoType="dijit.form.NumberTextBox"/>
      <input id="input1_10" name="input1" maxLength="6" type="text" dojoType="dijit.form.NumberTextBox"/>
      <input id="input1_11" name="input1" maxLength="6" type="text" dojoType="dijit.form.NumberTextBox"/>
      <input id="input1_12" name="input1" maxLength="6" type="text" dojoType="dijit.form.NumberTextBox"/>
      <input id="input1_13" name="input1" maxLength="6" type="text" dojoType="dijit.form.NumberTextBox"/>
      <input id="input1_14" name="input1" maxLength="6" type="text" dojoType="dijit.form.NumberTextBox"/>
      <input id="input1_15" name="input1" maxLength="6" type="text" dojoType="dijit.form.NumberTextBox"/>
      <input id="input1_16" name="input1" maxLength="6" type="text" dojoType="dijit.form.NumberTextBox"/>
      <input id="input1_17" name="input1" maxLength="6" type="text" dojoType="dijit.form.NumberTextBox"/>
      <input id="input1_18" name="input1" maxLength="6" type="text" dojoType="dijit.form.NumberTextBox"/>
      <input id="input1_19" name="input1" maxLength="6" type="text" dojoType="dijit.form.NumberTextBox"/>
      <input id="input1_20" name="input1" maxLength="6" type="text" dojoType="dijit.form.NumberTextBox"/>
      </form>
      <br/>
      <form id="form2" dojoType="dijit.form.Form" action="" method="">
      <input id="input2_1" name="input1" maxLength="6" type="text" dojoType="dijit.form.ValidationTextBox"/>
      <input id="input2_2" name="input1" maxLength="6" type="text" dojoType="dijit.form.ValidationTextBox"/>
      <input id="input2_3" name="input1" maxLength="6" type="text" dojoType="dijit.form.ValidationTextBox"/>
      <input id="input2_4" name="input1" maxLength="6" type="text" dojoType="dijit.form.ValidationTextBox"/>
      <input id="input2_5" name="input1" maxLength="6" type="text" dojoType="dijit.form.ValidationTextBox"/>
      <input id="input2_6" name="input1" maxLength="6" type="text" dojoType="dijit.form.ValidationTextBox"/>
      <input id="input2_7" name="input1" maxLength="6" type="text" dojoType="dijit.form.ValidationTextBox"/>
      <input id="input2_8" name="input1" maxLength="6" type="text" dojoType="dijit.form.ValidationTextBox"/>
      <input id="input2_9" name="input1" maxLength="6" type="text" dojoType="dijit.form.ValidationTextBox"/>
      <input id="input2_10" name="input1" maxLength="6" type="text" dojoType="dijit.form.ValidationTextBox"/>
      <input id="input2_11" name="input1" maxLength="6" type="text" dojoType="dijit.form.ValidationTextBox"/>
      <input id="input2_12" name="input1" maxLength="6" type="text" dojoType="dijit.form.ValidationTextBox"/>
      <input id="input2_13" name="input1" maxLength="6" type="text" dojoType="dijit.form.ValidationTextBox"/>
      <input id="input2_14" name="input1" maxLength="6" type="text" dojoType="dijit.form.ValidationTextBox"/>
      <input id="input2_15" name="input1" maxLength="6" type="text" dojoType="dijit.form.ValidationTextBox"/>
      <input id="input2_16" name="input1" maxLength="6" type="text" dojoType="dijit.form.ValidationTextBox"/>
      <input id="input2_17" name="input1" maxLength="6" type="text" dojoType="dijit.form.ValidationTextBox"/>
      <input id="input2_18" name="input1" maxLength="6" type="text" dojoType="dijit.form.ValidationTextBox"/>
      <input id="input2_19" name="input1" maxLength="6" type="text" dojoType="dijit.form.ValidationTextBox"/>
      <input id="input2_20" name="input1" maxLength="6" type="text" dojoType="dijit.form.ValidationTextBox"/>
      </form>
      <br/>
      <button name="button" onclick="performancetest()">Run tests</button>
  </body>
</html>
